<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:t="http://myfaces.apache.org/tomahawk"
  xmlns:ui="http://java.sun.com/jsf/facelets">
  
  <ui:composition template="/WEB-INF/layout/admin/adminTemplate.xhtml">
    <ui:define name="subheader">Add New Art Product</ui:define>
  
    <ui:define name="adminBody">
      <h:form enctype="multipart/form-data">
        <h:panelGrid columns="2">
          <h:outputLabel value="File" for="filename"/>
          <t:inputFileUpload value="#{addArtProductBean.file}"/> 
          
          <h:outputLabel value="Type" for="type"/>
          <h:selectOneMenu value="#{addArtProductBean.artProduct.type}">
            <f:selectItem itemValue="" itemLabel="Select"/>
            <f:selectItem itemValue="PAINTING" itemLabel="Painting"/>
            <f:selectItem itemValue="SKETCH" itemLabel="Sketch"/>
            <f:selectItem itemValue="PHOTOGRAPH" itemLabel="Photograph"/>
          </h:selectOneMenu>
          
          <h:outputLabel value="Description"/>
          <h:inputTextarea value="#{addArtProductBean.artProduct.description}" cols="45" rows="5"/>
          
          <h:outputLabel value="Price" for="price"/>
          <h:inputText value="#{addArtProductBean.artProduct.price}"/>
          <h:commandButton value="Upload" action="#{addArtProductBean.upload}"/>
        </h:panelGrid>
      </h:form>
      
      <h:outputText value="Successfully uploaded #{addArtProductBean.lastUploadedFile}." rendered="#{addArtProductBean.uploadResult == 'SUCCESS'}"/>
      <h:outputText value="Failed to uploaded file." rendered="#{addArtProductBean.uploadResult == 'FAILED'}"/>
    </ui:define>
  </ui:composition>
  
  <h:body>
  </h:body>
  
</html>